You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

[...nextauth].ts 632B

123456789101112131415161718192021222324252627
  1. import NextAuth from 'next-auth';
  2. import Credentials from 'next-auth/providers/credentials';
  3. import dbConnect from '../../../utils/helpers/dbHelpers';
  4. const User = require('../../../models/user');
  5. export default NextAuth({
  6. session: {
  7. // @ts-ignore
  8. jwt: true,
  9. },
  10. providers: [
  11. Credentials({
  12. // @ts-ignore
  13. async authorize(credentials) {
  14. await dbConnect();
  15. const user = await User.findByCredentials(
  16. // @ts-ignore
  17. credentials.username,
  18. // @ts-ignore
  19. credentials.password
  20. );
  21. return { name: user.fullName };
  22. },
  23. }),
  24. ],
  25. });